/* MAIN.C file
 * 
 * Copyright (c) 2002-2005 STMicroelectronics
 */
#include "stm8l15x.h"

 void ADC_Init1(void);
 u16 ADC_Icc_Test(u8 Mcu_State);
void main (void){
	
  
	u16 ret ;
	 disableInterrupts();  
	 	CLK->CKDIVR = CLK_SYSCLKDiv_2; //

	while(CLK->SCSR != CLK_SCSR_RESET_VALUE){ //HSI
		;
	}
	while(! (CLK->ICKCR&CLK_ICKCR_HSIRDY) ){
		;
	}
	SYSCFG->RMPCR3  =  2;
	ADC_Init1();
//ADC_ITConfig(ADC1,0 , ENABLE);
		enableInterrupts() ;
 
		ret =  ADC_Icc_Test( 0 );
		if ( ret)
			CLK->CKDIVR = CLK_SYSCLKDiv_2; //
		else
			CLK->CKDIVR = CLK_SYSCLKDiv_4; //
		disableInterrupts();   
 
}

 
